/**
 * Created by IntelliJ IDEA.
 * User: alexander
 * Date: 15.09.11
 * Time: 14:46
 * To change this template use File | Settings | File Templates.
 */
package com.towerdefence.enemies {
import com.etc.enemies.EnemieA;
import com.etc.enemies.EnemieB;
import com.etc.enemies.EnemieC;

import flash.display.MovieClip;

public class EnemyFactory {

	private static var ENEMIES:Object = {
		'enemy-a' : { clazz: EnemySoldier, maxHealth: 2, maxSpeed: 75, animation:EnemieA },
		'enemy-b' : { clazz: EnemySoldier, maxHealth: 4, maxSpeed: 60, animation:EnemieB },
		'enemy-c' : { clazz: EnemySoldier, maxHealth: 7, maxSpeed: 52, animation:EnemieC }
	};

	public static function newEnemy( name: String ): EnemySoldier{
		var t: Object = ENEMIES[name];
		var cls: Class = t.clazz;
		var e: EnemySoldier = new cls() as EnemySoldier;
		e.animation = (new t.animation()) as MovieClip;
		e.maxHealth = t.maxHealth;
		e.maxSpeed = t.maxSpeed;
		return e;
	}

}
}

